<%--
  Created by IntelliJ IDEA.
  User: guo
  Date: 2017/10/29
  Time: 22:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1 id="hid" align="center">商品列表</h1>
<%--搜索框:模糊查询--%>
<div style="text-align: center">
    <form action="${pageContext.request.contextPath}/conditionServlet" method="post">
        <input type="text" name="condition" value="${c}">
        <input type="submit"  value="搜索">
    </form>
</div>
<%--添加商品--%>
<hr>
<div id="tp" align="center"><a href="${pageContext.request.contextPath}/cart/add.jsp">添加</a></div>
<%--商品列表--%>
<form action="" >
    <table align="center" border="1" cellspacing="0" width="800px" id="tbox">
        <tr>
            <td>序号</td>
            <td>商品名称</td>
            <td>商品价格</td>
            <td>操作</td>
        </tr>
        <c:forEach var="p" items="${pageBean.pageList}" varStatus="status">
            <c:choose>
                <c:when test="${status.count%2==0}">
                    <tr style="background-color: gray">
                        <td>${status.count}</td>
                        <td>${p.pname}</td>
                        <td>${p["market_price"]}</td>
                        <td><a href="${pageContext.request.contextPath}/editUIServlet?pid=${p.pid}">修改</a>
                            <a href="${pageContext.request.contextPath}/deleteServlet?pid=${p.pid}" onclick="return confirm('确认是否删除')">删除</a></td>
                    </tr>
                </c:when>
                <c:otherwise>
                    <tr>
                        <td>${status.count}</td>
                        <td>${p.pname}</td>
                        <td>${p["market_price"]}</td>
                        <td><a href="${pageContext.request.contextPath}/editUIServlet?pid=${p.pid}">修改</a>
                            <a href="${pageContext.request.contextPath}/deleteServlet?pid=${p.pid}" onclick="return confirm('确认是否删除')">删除</a></td>
                    </tr>
                </c:otherwise>
            </c:choose>
        </c:forEach>
    </table>
    <%--分页查询栏--%>
    第${pageBean.currenPage}页/共${pageBean.pageCount}页
    <a href="">上一页</a>
    <a href="">下一页</a>
</form>
</body>
</html>
